//
//  LocationView.m
//  SHPE Conference Companion
//
//  Created by Alex Muller on 4/10/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "LocationView.h"
#import "ConferenceAnnotation.h"

@implementation LocationView

@synthesize mapView, confAnno;

+ (CGFloat)annotationPadding;
{
    return 10.0f;
}
+ (CGFloat)calloutHeight;
{
    return 40.0f;
}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}


- (IBAction)releaseLocation {
    [self dismissModalViewControllerAnimated:YES];
}

- (void)dealloc
{
    [super dealloc];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	
    MKCoordinateRegion region={{0.0,0.0,},{0,0.0}};
	//region.center.latitude = 30.44;
	//region.center.longitude = -84.31;
	region.span.latitudeDelta=0.03;
	region.span.longitudeDelta=0.03;
	[mapView setRegion:region animated:YES]; 
	[mapView setMapType:MKMapTypeStandard];
	[mapView setZoomEnabled:YES];
	[mapView setScrollEnabled:NO];
    
    ConferenceAnnotation *confAnnotation = [[[ConferenceAnnotation alloc] init] autorelease];

    [self.mapView removeAnnotations:self.mapView.annotations];  
    [self.mapView addAnnotation:confAnnotation];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
